library(here)
library(tidyverse)
library(cowplot)
library(GGally)
theme_set(theme_light())

library(scuttle)
library(scater)

library(kableExtra)
library(DDCompanion)

Setup

## Directory setup
here_root <- "benchmarks/covid"
here::i_am(file.path(here_root, "analysis/covid-mock-results.Rmd"))
#> here() starts at /kyukon/data/gent/vo/000/gvo00063/Jeroen/DD_project_v2

res_dir <- here::here(here_root, "results")
fig_dir <- here::here(here_root, "figures")
  • Using methods: bGLM, qbGLM, qbGLM_offset, qbGLM_offset_squeeze, edgeR_NB, edgeR_QP, edgeR_NB_optim, edgeR_QP_optim
  • Using celltypes: class_switched_memory_B_cell_Healthy, immature_B_cell_Healthy, naive_B_cell_Healthy, class_switched_memory_B_cell_Mild, immature_B_cell_Mild, naive_B_cell_Mild, class_switched_memory_B_cell_Moderate, immature_B_cell_Moderate, naive_B_cell_Moderate, class_switched_memory_B_cell_Critical, immature_B_cell_Critical, naive_B_cell_Critical
  • Using datatype: pb

Load results

res_files <- map(celltypes, ~ get_mock_res_files(
    dataset = "covid",
    datatype = datatype,
    methods = methods,
    celltype = .x
)) %>%
    set_names(celltypes)

#res_list <- map_depth(res_files, 2, readRDS)
res_list <- lapply(res_files, function(element){
    lapply(element, readRDS)
})

## Check for expected data structure
stopifnot(unlist(map_depth(res_list, 3, ~ is.data.frame(.x$results))))

Load SCE objects

data_files <- map(celltypes, ~ get_SCE_files(
    dataset = "covid", which = "mock_replicates",
    celltype = .x
)) %>%
    set_names(celltypes)
sce_objects <- map(data_files, readRDS)

Data overview

  • The results were generated from 5 mock replicates
  • Each replicate was generated by randomly splitting the subjects in two mock groups
  • No sub-sampling of cells per patient was performed for this data
map_dfr(sce_objects,
    ~ map_dfr(.x, function(x) c(nrows = nrow(x), ncols = ncol(x)),
        .id = "replicate"
    ),
    .id = "celltypes"
)

Subjects are divided across mock groups as follows:

map(sce_objects[[1]], function(x) table(x$donor_id, x$mock_group))
#> $replicate_1
#>              
#>                 A   B
#>   CV0902       49   0
#>   CV0904      102   0
#>   CV0911        0  23
#>   CV0915       26   0
#>   CV0917       21   0
#>   CV0926        0  23
#>   CV0929        0  48
#>   CV0934        0  55
#>   MH8919178    99   0
#>   MH8919227     0  44
#>   MH8919282     0  51
#>   MH8919283    80   0
#>   MH8919333     0 229
#>   newcastle74  89   0
#> 
#> $replicate_2
#>              
#>                 A   B
#>   CV0902       49   0
#>   CV0904      102   0
#>   CV0911       23   0
#>   CV0915        0  26
#>   CV0917        0  21
#>   CV0926        0  23
#>   CV0929        0  48
#>   CV0934       55   0
#>   MH8919178     0  99
#>   MH8919227    44   0
#>   MH8919282    51   0
#>   MH8919283     0  80
#>   MH8919333   229   0
#>   newcastle74   0  89
#> 
#> $replicate_3
#>              
#>                 A   B
#>   CV0902       49   0
#>   CV0904      102   0
#>   CV0911        0  23
#>   CV0915       26   0
#>   CV0917       21   0
#>   CV0926        0  23
#>   CV0929        0  48
#>   CV0934        0  55
#>   MH8919178    99   0
#>   MH8919227    44   0
#>   MH8919282    51   0
#>   MH8919283     0  80
#>   MH8919333     0 229
#>   newcastle74   0  89
#> 
#> $replicate_4
#>              
#>                 A   B
#>   CV0902        0  49
#>   CV0904      102   0
#>   CV0911       23   0
#>   CV0915        0  26
#>   CV0917       21   0
#>   CV0926        0  23
#>   CV0929       48   0
#>   CV0934        0  55
#>   MH8919178     0  99
#>   MH8919227     0  44
#>   MH8919282     0  51
#>   MH8919283    80   0
#>   MH8919333   229   0
#>   newcastle74  89   0
#> 
#> $replicate_5
#>              
#>                 A   B
#>   CV0902       49   0
#>   CV0904        0 102
#>   CV0911       23   0
#>   CV0915        0  26
#>   CV0917        0  21
#>   CV0926       23   0
#>   CV0929        0  48
#>   CV0934       55   0
#>   MH8919178     0  99
#>   MH8919227    44   0
#>   MH8919282    51   0
#>   MH8919283     0  80
#>   MH8919333     0 229
#>   newcastle74  89   0

Extract results of interest

Runtimes

## Get runtimes for each celltype
runtimes <- map(res_list, ~ map_dfr(.x, get_runtimes, depth = 1, .id = "method"))

P-values

res_tables <- map_depth(
    res_list, 2,
    ~ get_aggregated_rep_tables(.x, depth = 1)
) %>%
    map(combine_tables, .id = "method")

Visualize results

Run times

runtime_plots <- imap(runtimes,
    ~ plot_run_times(.x, width = 0.2, height = 0) +
      ggtitle(.y)
)

class_switched_memory_B_cell_Healthy

immature_B_cell_Healthy

naive_B_cell_Healthy

class_switched_memory_B_cell_Mild

immature_B_cell_Mild

naive_B_cell_Mild

class_switched_memory_B_cell_Moderate

immature_B_cell_Moderate

naive_B_cell_Moderate

class_switched_memory_B_cell_Critical

immature_B_cell_Critical

naive_B_cell_Critical

Number of significant genes for different FDR levels

n_sign_summaries <- map(res_tables, function(tmp) {
    tmp %>%
        group_by(replicate, method) %>%
        summarise(
            sum(FDR < 0.01),
            sum(FDR < 0.05),
            sum(FDR < 0.1),
            .groups = "drop"
        )
})

class_switched_memory_B_cell_Healthy

Cells per patient: class_switched_memory_B_cell_Healthy
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 10 17 22
edgeR_NB 0 0 1
edgeR_NB_optim 2 4 6
edgeR_QP 0 0 0
edgeR_QP_optim 3 5 5
qbGLM 295 302 309
qbGLM_offset 292 298 314
qbGLM_offset_squeeze 1 2 2
Replicate: 2
bGLM 15 34 43
edgeR_NB 0 0 0
edgeR_NB_optim 0 1 2
edgeR_QP 0 0 0
edgeR_QP_optim 0 2 2
qbGLM 298 303 310
qbGLM_offset 293 301 318
qbGLM_offset_squeeze 1 3 3
Replicate: 3
bGLM 608 1375 1933
edgeR_NB 0 10 62
edgeR_NB_optim 0 5 7
edgeR_QP 0 80 297
edgeR_QP_optim 0 3 7
qbGLM 312 416 623
qbGLM_offset 300 322 347
qbGLM_offset_squeeze 0 1 1
Replicate: 4
bGLM 513 1231 1883
edgeR_NB 3 9 37
edgeR_NB_optim 0 4 17
edgeR_QP 4 38 155
edgeR_QP_optim 0 4 18
qbGLM 315 404 554
qbGLM_offset 302 319 342
qbGLM_offset_squeeze 0 2 3
Replicate: 5
bGLM 23 86 192
edgeR_NB 0 0 2
edgeR_NB_optim 1 2 3
edgeR_QP 1 2 2
edgeR_QP_optim 1 2 2
qbGLM 295 314 326
qbGLM_offset 294 308 323
qbGLM_offset_squeeze 0 1 1

immature_B_cell_Healthy

Cells per patient: immature_B_cell_Healthy
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 20 82 203
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 1 1 1
edgeR_QP_optim 0 0 0
qbGLM 50 50 54
qbGLM_offset 50 53 54
qbGLM_offset_squeeze 0 1 1
Replicate: 2
bGLM 0 3 4
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 56 59 59
qbGLM_offset 54 54 57
qbGLM_offset_squeeze 0 0 0
Replicate: 3
bGLM 3 5 5
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 54 57 57
qbGLM_offset 54 54 55
qbGLM_offset_squeeze 0 0 0
Replicate: 4
bGLM 243 629 1038
edgeR_NB 0 1 13
edgeR_NB_optim 3 3 3
edgeR_QP 1 21 33
edgeR_QP_optim 3 3 3
qbGLM 49 56 68
qbGLM_offset 50 54 57
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 7 14 52
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 1 1 1
edgeR_QP_optim 0 0 0
qbGLM 49 50 54
qbGLM_offset 50 53 53
qbGLM_offset_squeeze 0 1 1

naive_B_cell_Healthy

Cells per patient: naive_B_cell_Healthy
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 4984 6439 7249
edgeR_NB 0 1 2
edgeR_NB_optim 25 52 77
edgeR_QP 125 1896 3995
edgeR_QP_optim 119 233 333
qbGLM 1 11 2596
qbGLM_offset 1 3 4
qbGLM_offset_squeeze 1 3 24
Replicate: 2
bGLM 1972 3188 3953
edgeR_NB 0 0 0
edgeR_NB_optim 13 23 25
edgeR_QP 0 2 2
edgeR_QP_optim 30 52 63
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 3
bGLM 2217 3668 4635
edgeR_NB 0 0 0
edgeR_NB_optim 7 13 18
edgeR_QP 0 1 1
edgeR_QP_optim 15 25 44
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 4
bGLM 96 188 268
edgeR_NB 0 0 0
edgeR_NB_optim 12 15 24
edgeR_QP 0 1 2
edgeR_QP_optim 16 29 34
qbGLM 0 1 1
qbGLM_offset 1 1 2
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 1082 2044 2779
edgeR_NB 1 1 1
edgeR_NB_optim 18 32 46
edgeR_QP 1 1 1
edgeR_QP_optim 29 62 71
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0

class_switched_memory_B_cell_Mild

Cells per patient: class_switched_memory_B_cell_Mild
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 9 25 47
edgeR_NB 1 1 1
edgeR_NB_optim 1 1 1
edgeR_QP 1 1 1
edgeR_QP_optim 1 1 1
qbGLM 0 1 1
qbGLM_offset 0 1 1
qbGLM_offset_squeeze 0 0 0
Replicate: 2
bGLM 14 33 48
edgeR_NB 5 6 6
edgeR_NB_optim 6 8 10
edgeR_QP 5 12 13
edgeR_QP_optim 6 11 13
qbGLM 0 2 2
qbGLM_offset 2 2 2
qbGLM_offset_squeeze 0 0 1
Replicate: 3
bGLM 97 307 465
edgeR_NB 3 13 38
edgeR_NB_optim 2 3 3
edgeR_QP 3 14 56
edgeR_QP_optim 2 3 3
qbGLM 1 1 7
qbGLM_offset 1 2 2
qbGLM_offset_squeeze 0 1 1
Replicate: 4
bGLM 5 5 9
edgeR_NB 1 1 1
edgeR_NB_optim 0 1 3
edgeR_QP 1 2 2
edgeR_QP_optim 0 3 3
qbGLM 0 1 1
qbGLM_offset 0 1 1
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 22 42 46
edgeR_NB 7 9 12
edgeR_NB_optim 12 14 15
edgeR_QP 7 11 15
edgeR_QP_optim 11 14 16
qbGLM 0 0 1
qbGLM_offset 0 0 1
qbGLM_offset_squeeze 0 0 0

immature_B_cell_Mild

Cells per patient: immature_B_cell_Mild
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 7 15 18
edgeR_NB 1 2 3
edgeR_NB_optim 1 1 1
edgeR_QP 1 1 2
edgeR_QP_optim 1 1 2
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 2
bGLM 2 5 6
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 1
qbGLM 0 0 0
qbGLM_offset 0 0 1
qbGLM_offset_squeeze 0 0 0
Replicate: 3
bGLM 1 8 13
edgeR_NB 1 1 1
edgeR_NB_optim 1 2 2
edgeR_QP 1 1 1
edgeR_QP_optim 0 2 2
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 4
bGLM 13 24 34
edgeR_NB 0 0 1
edgeR_NB_optim 0 1 2
edgeR_QP 0 0 1
edgeR_QP_optim 0 1 2
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 7 9 11
edgeR_NB 0 0 0
edgeR_NB_optim 0 1 1
edgeR_QP 0 0 0
edgeR_QP_optim 0 1 1
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0

naive_B_cell_Mild

Cells per patient: naive_B_cell_Mild
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 744 1210 1594
edgeR_NB 0 0 1
edgeR_NB_optim 0 1 1
edgeR_QP 1 1 2
edgeR_QP_optim 1 1 3
qbGLM 84 92 96
qbGLM_offset 85 93 106
qbGLM_offset_squeeze 0 0 0
Replicate: 2
bGLM 338 608 845
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 86 88 92
qbGLM_offset 86 88 92
qbGLM_offset_squeeze 0 0 0
Replicate: 3
bGLM 867 1425 1853
edgeR_NB 0 0 0
edgeR_NB_optim 1 2 2
edgeR_QP 0 0 0
edgeR_QP_optim 1 2 4
qbGLM 85 94 103
qbGLM_offset 89 97 105
qbGLM_offset_squeeze 1 3 6
Replicate: 4
bGLM 378 690 909
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 3 6 7
edgeR_QP_optim 3 7 8
qbGLM 82 84 89
qbGLM_offset 82 90 94
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 384 800 1163
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 3
qbGLM 84 85 86
qbGLM_offset 84 86 92
qbGLM_offset_squeeze 0 0 0

class_switched_memory_B_cell_Moderate

Cells per patient: class_switched_memory_B_cell_Moderate
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 13 37 56
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 2
bGLM 25 63 101
edgeR_NB 0 2 3
edgeR_NB_optim 2 2 3
edgeR_QP 1 3 3
edgeR_QP_optim 2 4 14
qbGLM 0 0 0
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 3
bGLM 41 83 136
edgeR_NB 0 0 0
edgeR_NB_optim 1 1 3
edgeR_QP 0 0 4
edgeR_QP_optim 1 2 3
qbGLM 1 1 1
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 4
bGLM 33 67 93
edgeR_NB 0 0 0
edgeR_NB_optim 0 1 5
edgeR_QP 0 0 0
edgeR_QP_optim 0 5 13
qbGLM 1 1 1
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 15 21 31
edgeR_NB 0 0 1
edgeR_NB_optim 1 1 1
edgeR_QP 0 0 0
edgeR_QP_optim 1 2 3
qbGLM 1 1 1
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0

immature_B_cell_Moderate

Cells per patient: immature_B_cell_Moderate
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 29 46 65
edgeR_NB 0 1 2
edgeR_NB_optim 3 6 6
edgeR_QP 2 2 3
edgeR_QP_optim 5 7 9
qbGLM 3 3 3
qbGLM_offset 0 0 0
qbGLM_offset_squeeze 0 0 0
Replicate: 2
bGLM 6 18 30
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 2
edgeR_QP_optim 0 2 2
qbGLM 4 4 4
qbGLM_offset 1 1 1
qbGLM_offset_squeeze 0 0 0
Replicate: 3
bGLM 2 9 13
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 4 4 4
qbGLM_offset 1 1 1
qbGLM_offset_squeeze 0 0 0
Replicate: 4
bGLM 33 66 98
edgeR_NB 0 1 1
edgeR_NB_optim 0 12 25
edgeR_QP 0 3 13
edgeR_QP_optim 0 16 29
qbGLM 1 1 1
qbGLM_offset 1 1 1
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 25 43 57
edgeR_NB 0 1 1
edgeR_NB_optim 3 3 3
edgeR_QP 3 3 4
edgeR_QP_optim 3 3 3
qbGLM 1 1 1
qbGLM_offset 1 1 2
qbGLM_offset_squeeze 0 0 0

naive_B_cell_Moderate

Cells per patient: naive_B_cell_Moderate
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 1470 2221 2758
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 62 64 70
qbGLM_offset 62 66 75
qbGLM_offset_squeeze 0 0 0
Replicate: 2
bGLM 2336 3403 4150
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 29
edgeR_QP_optim 1 40 248
qbGLM 62 66 75
qbGLM_offset 64 86 161
qbGLM_offset_squeeze 0 1 1
Replicate: 3
bGLM 2233 3228 3935
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 1
edgeR_QP 0 2 6
edgeR_QP_optim 0 12 68
qbGLM 62 65 70
qbGLM_offset 65 79 117
qbGLM_offset_squeeze 0 0 0
Replicate: 4
bGLM 1056 1809 2390
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 62 63 63
qbGLM_offset 62 63 67
qbGLM_offset_squeeze 0 0 0
Replicate: 5
bGLM 1100 1736 2220
edgeR_NB 0 0 0
edgeR_NB_optim 0 1 1
edgeR_QP 1 1 1
edgeR_QP_optim 1 1 1
qbGLM 63 64 69
qbGLM_offset 63 72 78
qbGLM_offset_squeeze 0 0 0

class_switched_memory_B_cell_Critical

Cells per patient: class_switched_memory_B_cell_Critical
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 0 0 2
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 608 633 646
qbGLM_offset 623 639 670
qbGLM_offset_squeeze 0 1 8
Replicate: 2
bGLM 1 5 8
edgeR_NB 0 1 1
edgeR_NB_optim 1 1 1
edgeR_QP 1 1 1
edgeR_QP_optim 1 1 1
qbGLM 610 628 649
qbGLM_offset 619 633 662
qbGLM_offset_squeeze 0 1 1
Replicate: 3
bGLM 3 4 15
edgeR_NB 0 1 1
edgeR_NB_optim 1 1 3
edgeR_QP 1 1 1
edgeR_QP_optim 1 1 6
qbGLM 625 653 689
qbGLM_offset 625 656 687
qbGLM_offset_squeeze 0 1 9
Replicate: 4
bGLM 26 58 79
edgeR_NB 1 1 2
edgeR_NB_optim 5 13 17
edgeR_QP 6 7 9
edgeR_QP_optim 6 12 17
qbGLM 618 647 679
qbGLM_offset 630 665 711
qbGLM_offset_squeeze 0 2 12
Replicate: 5
bGLM 121 412 634
edgeR_NB 10 17 32
edgeR_NB_optim 6 14 23
edgeR_QP 13 33 62
edgeR_QP_optim 6 21 25
qbGLM 629 695 802
qbGLM_offset 620 653 682
qbGLM_offset_squeeze 0 1 11

immature_B_cell_Critical

Cells per patient: immature_B_cell_Critical
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 0 5 6
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 769 780 792
qbGLM_offset 765 785 804
qbGLM_offset_squeeze 0 11 11
Replicate: 2
bGLM 0 2 3
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 764 782 792
qbGLM_offset 764 781 798
qbGLM_offset_squeeze 0 10 10
Replicate: 3
bGLM 0 0 1
edgeR_NB 0 0 0
edgeR_NB_optim 0 0 0
edgeR_QP 0 0 0
edgeR_QP_optim 0 0 0
qbGLM 770 782 794
qbGLM_offset 771 789 813
qbGLM_offset_squeeze 0 11 56
Replicate: 4
bGLM 18 47 63
edgeR_NB 1 1 2
edgeR_NB_optim 6 9 12
edgeR_QP 5 7 8
edgeR_QP_optim 7 9 12
qbGLM 771 791 811
qbGLM_offset 772 791 826
qbGLM_offset_squeeze 9 11 54
Replicate: 5
bGLM 23 83 148
edgeR_NB 1 1 1
edgeR_NB_optim 0 1 1
edgeR_QP 3 3 3
edgeR_QP_optim 0 1 5
qbGLM 776 810 872
qbGLM_offset 774 794 848
qbGLM_offset_squeeze 9 9 56

naive_B_cell_Critical

Cells per patient: naive_B_cell_Critical
method sum(FDR < 0.01) sum(FDR < 0.05) sum(FDR < 0.1)
Replicate: 1
bGLM 1005 1624 2113
edgeR_NB 0 0 0
edgeR_NB_optim 26 50 58
edgeR_QP 22 45 85
edgeR_QP_optim 130 193 251
qbGLM 466 488 516
qbGLM_offset 475 521 587
qbGLM_offset_squeeze 0 7 7
Replicate: 2
bGLM 2314 3438 4248
edgeR_NB 1 2 4
edgeR_NB_optim 27 51 65
edgeR_QP 66 153 352
edgeR_QP_optim 122 187 257
qbGLM 314 388 490
qbGLM_offset 309 359 413
qbGLM_offset_squeeze 0 0 0
Replicate: 3
bGLM 840 1363 1828
edgeR_NB 2 2 2
edgeR_NB_optim 30 40 46
edgeR_QP 37 56 71
edgeR_QP_optim 119 195 241
qbGLM 292 302 330
qbGLM_offset 295 325 371
qbGLM_offset_squeeze 0 4 9
Replicate: 4
bGLM 803 1721 2559
edgeR_NB 5 11 14
edgeR_NB_optim 19 34 42
edgeR_QP 20 42 54
edgeR_QP_optim 42 70 88
qbGLM 409 444 473
qbGLM_offset 410 439 483
qbGLM_offset_squeeze 0 4 5
Replicate: 5
bGLM 1607 2598 3280
edgeR_NB 1 1 1
edgeR_NB_optim 23 36 56
edgeR_QP 79 164 293
edgeR_QP_optim 115 194 241
qbGLM 285 305 345
qbGLM_offset 289 311 351
qbGLM_offset_squeeze 0 0 0

P-value distributions

pval_figs <- map(res_tables, pval_hist)

class_switched_memory_B_cell_Healthy

immature_B_cell_Healthy

naive_B_cell_Healthy

class_switched_memory_B_cell_Mild

immature_B_cell_Mild

naive_B_cell_Mild

class_switched_memory_B_cell_Moderate

immature_B_cell_Moderate

naive_B_cell_Moderate

class_switched_memory_B_cell_Critical

immature_B_cell_Critical

naive_B_cell_Critical

P-value distributions stratified by expression level

For each replicate, calculate average log-normalized counts, using scuttle::calculateAverage().

## Calculate average counts for each replicate
avg_counts <- map_depth(sce_objects, 2,
    ~ calculateAverage(counts(.x))
)

## Split res_tables per replicate
res_tables_split <- map(res_tables, ~ split(.x, .x$replicate))

## Add average counts to results tables
## Note that for the 'combined' celltypes, the average counts will be the same
## for each celltype contrast
res_tables_split <- map2(
    res_tables_split, avg_counts,
    ~ map2(.x, .y, function(res, avg_cnt) {
        res$avg_count <- avg_cnt[res$gene]
        res
    })
)

Make p-value histograms stratified by the average counts.

pval_hist_strat_plots <- map(res_tables_split,
    ~ imap(.x, function(y, replicate) {
        replicate <- str_remove(replicate, "replicate_")
        title <- paste("Replicate:", replicate)
        pval_hist_strat(y, n_groups = 6) +
            ggtitle(title)
    })
)

class_switched_memory_B_cell_Healthy

immature_B_cell_Healthy

naive_B_cell_Healthy

class_switched_memory_B_cell_Mild

immature_B_cell_Mild

naive_B_cell_Mild

class_switched_memory_B_cell_Moderate

immature_B_cell_Moderate

naive_B_cell_Moderate

class_switched_memory_B_cell_Critical

immature_B_cell_Critical

naive_B_cell_Critical

Session info

Session info
#> [1] "2023-07-21 19:16:19 CEST"
#> ─ Session info ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.2.0 (2022-04-22)
#>  os       Red Hat Enterprise Linux 8.6 (Ootpa)
#>  system   x86_64, linux-gnu
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Europe/Paris
#>  date     2023-07-21
#>  pandoc   2.13 @ /apps/gent/RHEL8/zen2-ib/software/Pandoc/2.13/bin/ (via rmarkdown)
#> 
#> ─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
#>  ! package              * version   date (UTC) lib source
#>  P argparse             * 2.2.2     2023-02-15 [?] CRAN (R 4.2.0)
#>  P beachmat               2.14.2    2023-04-07 [?] Bioconductor
#>  P beeswarm               0.4.0     2021-06-01 [?] CRAN (R 4.2.0)
#>  P Biobase              * 2.58.0    2022-11-01 [?] Bioconductor
#>  P BiocGenerics         * 0.44.0    2022-11-01 [?] Bioconductor
#>  P BiocManager            1.30.20   2023-02-24 [?] CRAN (R 4.2.0)
#>  P BiocNeighbors          1.16.0    2022-11-01 [?] Bioconductor
#>  P BiocParallel           1.32.6    2023-03-17 [?] Bioconductor
#>  P BiocSingular           1.14.0    2022-11-01 [?] Bioconductor
#>  P bitops                 1.0-7     2021-04-24 [?] CRAN (R 4.2.0)
#>  P bluster                1.8.0     2022-11-01 [?] Bioconductor
#>  P bslib                  0.4.2     2022-12-16 [?] CRAN (R 4.2.0)
#>  P cachem                 1.0.8     2023-05-01 [?] CRAN (R 4.2.0)
#>  P cli                    3.6.1     2023-03-23 [?] CRAN (R 4.2.0)
#>  P cluster                2.1.4     2022-08-22 [?] CRAN (R 4.2.0)
#>  P codetools              0.2-19    2023-02-01 [?] CRAN (R 4.2.0)
#>  P colorspace             2.1-0     2023-01-23 [?] CRAN (R 4.2.0)
#>  P cowplot              * 1.1.1     2020-12-30 [?] CRAN (R 4.2.0)
#>    DDCompanion          * 0.1.15    2023-05-22 [1] local (./package)
#>  P DelayedArray           0.24.0    2022-11-01 [?] Bioconductor
#>  P DelayedMatrixStats     1.20.0    2022-11-01 [?] Bioconductor
#>  P digest                 0.6.31    2022-12-11 [?] CRAN (R 4.2.0)
#>  P dplyr                * 1.1.2     2023-04-20 [?] CRAN (R 4.2.0)
#>  P dqrng                  0.3.0     2021-05-01 [?] CRAN (R 4.2.0)
#>  P DT                     0.28      2023-05-18 [?] CRAN (R 4.2.0)
#>  P edgeR                  3.40.2    2023-01-19 [?] Bioconductor
#>  P ellipsis               0.3.2     2021-04-29 [?] CRAN (R 4.2.0)
#>  P evaluate               0.21      2023-05-05 [?] CRAN (R 4.2.0)
#>  P fansi                  1.0.4     2023-01-22 [?] CRAN (R 4.2.0)
#>  P farver                 2.1.1     2022-07-06 [?] CRAN (R 4.2.0)
#>  P fastmap                1.1.1     2023-02-24 [?] CRAN (R 4.2.0)
#>  P findpython             1.0.8     2023-03-14 [?] CRAN (R 4.2.0)
#>  P forcats              * 1.0.0     2023-01-29 [?] CRAN (R 4.2.0)
#>  P generics               0.1.3     2022-07-05 [?] CRAN (R 4.2.0)
#>  P GenomeInfoDb         * 1.34.9    2023-02-02 [?] Bioconductor
#>  P GenomeInfoDbData       1.2.9     2023-05-20 [?] Bioconductor
#>  P GenomicRanges        * 1.50.2    2022-12-16 [?] Bioconductor
#>  P GGally               * 2.1.2     2021-06-21 [?] CRAN (R 4.2.0)
#>  P ggbeeswarm             0.7.2     2023-04-29 [?] CRAN (R 4.2.0)
#>  P ggplot2              * 3.4.2     2023-04-03 [?] CRAN (R 4.2.0)
#>  P ggrepel                0.9.3     2023-02-03 [?] CRAN (R 4.2.0)
#>  P glue                   1.6.2     2022-02-24 [?] CRAN (R 4.2.0)
#>  P gridExtra              2.3       2017-09-09 [?] CRAN (R 4.2.0)
#>  P gtable                 0.3.3     2023-03-21 [?] CRAN (R 4.2.0)
#>  P here                 * 1.0.1     2020-12-13 [?] CRAN (R 4.2.0)
#>  P highr                  0.10      2022-12-22 [?] CRAN (R 4.2.0)
#>  P hms                    1.1.3     2023-03-21 [?] CRAN (R 4.2.0)
#>  P htmltools              0.5.5     2023-03-23 [?] CRAN (R 4.2.0)
#>  P htmlwidgets            1.6.2     2023-03-17 [?] CRAN (R 4.2.0)
#>  P httpuv                 1.6.11    2023-05-11 [?] CRAN (R 4.2.0)
#>  P httr                   1.4.6     2023-05-08 [?] CRAN (R 4.2.0)
#>  P iCOBRA                 1.26.0    2022-11-01 [?] Bioconductor
#>  P igraph                 1.4.3     2023-05-22 [?] CRAN (R 4.2.0)
#>  P IRanges              * 2.32.0    2022-11-01 [?] Bioconductor
#>  P irlba                  2.3.5.1   2022-10-03 [?] CRAN (R 4.2.0)
#>  P jquerylib              0.1.4     2021-04-26 [?] CRAN (R 4.2.0)
#>  P jsonlite               1.8.4     2022-12-06 [?] CRAN (R 4.2.0)
#>  P kableExtra           * 1.3.4     2021-02-20 [?] CRAN (R 4.2.0)
#>  P knitr                  1.42      2023-01-25 [?] CRAN (R 4.2.0)
#>  P labeling               0.4.2     2020-10-20 [?] CRAN (R 4.2.0)
#>  P later                  1.3.1     2023-05-02 [?] CRAN (R 4.2.0)
#>  P lattice                0.21-8    2023-04-05 [?] CRAN (R 4.2.0)
#>  P lifecycle              1.0.3     2022-10-07 [?] CRAN (R 4.2.0)
#>  P limma                  3.54.2    2023-02-28 [?] Bioconductor
#>  P locfit                 1.5-9.7   2023-01-02 [?] CRAN (R 4.2.0)
#>  P lubridate            * 1.9.2     2023-02-10 [?] CRAN (R 4.2.0)
#>  P magrittr               2.0.3     2022-03-30 [?] CRAN (R 4.2.0)
#>  P Matrix                 1.5-4.1   2023-05-18 [?] CRAN (R 4.2.0)
#>  P MatrixGenerics       * 1.10.0    2022-11-01 [?] Bioconductor
#>  P matrixStats          * 0.63.0    2022-11-18 [?] CRAN (R 4.2.0)
#>  P metapod                1.6.0     2022-11-01 [?] Bioconductor
#>  P mime                   0.12      2021-09-28 [?] CRAN (R 4.2.0)
#>  P munsell                0.5.0     2018-06-12 [?] CRAN (R 4.2.0)
#>  P pillar                 1.9.0     2023-03-22 [?] CRAN (R 4.2.0)
#>  P pkgconfig              2.0.3     2019-09-22 [?] CRAN (R 4.2.0)
#>  P plyr                   1.8.8     2022-11-11 [?] CRAN (R 4.2.0)
#>  P promises               1.2.0.1   2021-02-11 [?] CRAN (R 4.2.0)
#>  P purrr                * 1.0.1     2023-01-10 [?] CRAN (R 4.2.0)
#>  P R6                     2.5.1     2021-08-19 [?] CRAN (R 4.2.0)
#>  P RColorBrewer           1.1-3     2022-04-03 [?] CRAN (R 4.2.0)
#>  P Rcpp                   1.0.10    2023-01-22 [?] CRAN (R 4.2.0)
#>  P RCurl                  1.98-1.12 2023-03-27 [?] CRAN (R 4.2.0)
#>  P readr                * 2.1.4     2023-02-10 [?] CRAN (R 4.2.0)
#>    renv                   0.17.3    2023-04-06 [1] CRAN (R 4.2.0)
#>  P reshape                0.8.9     2022-04-12 [?] CRAN (R 4.2.0)
#>  P reshape2               1.4.4     2020-04-09 [?] CRAN (R 4.2.0)
#>  P rlang                  1.1.1     2023-04-28 [?] CRAN (R 4.2.0)
#>  P rmarkdown              2.21      2023-03-26 [?] CRAN (R 4.2.0)
#>  P ROCR                   1.0-11    2020-05-02 [?] CRAN (R 4.2.0)
#>  P rprojroot              2.0.3     2022-04-02 [?] CRAN (R 4.2.0)
#>  P rstudioapi             0.14      2022-08-22 [?] CRAN (R 4.2.0)
#>  P rsvd                   1.0.5     2021-04-16 [?] CRAN (R 4.2.0)
#>  P rvest                  1.0.3     2022-08-19 [?] CRAN (R 4.2.0)
#>  P S4Vectors            * 0.36.2    2023-02-26 [?] Bioconductor
#>  P sass                   0.4.6     2023-05-03 [?] CRAN (R 4.2.0)
#>  P ScaledMatrix           1.6.0     2022-11-01 [?] Bioconductor
#>  P scales                 1.2.1     2022-08-20 [?] CRAN (R 4.2.0)
#>  P scater               * 1.26.1    2022-11-13 [?] Bioconductor
#>  P scran                  1.26.2    2023-01-19 [?] Bioconductor
#>  P scuttle              * 1.8.4     2023-01-19 [?] Bioconductor
#>  P sessioninfo            1.2.2     2021-12-06 [?] CRAN (R 4.2.0)
#>  P shiny                  1.7.4     2022-12-15 [?] CRAN (R 4.2.0)
#>  P shinyBS                0.61.1    2022-04-17 [?] CRAN (R 4.2.0)
#>  P shinydashboard         0.7.2     2021-09-30 [?] CRAN (R 4.2.0)
#>  P SingleCellExperiment * 1.20.1    2023-03-17 [?] Bioconductor
#>  P sparseMatrixStats      1.10.0    2022-11-01 [?] Bioconductor
#>  P statmod                1.5.0     2023-01-06 [?] CRAN (R 4.2.0)
#>  P stringi                1.7.12    2023-01-11 [?] CRAN (R 4.2.0)
#>  P stringr              * 1.5.0     2022-12-02 [?] CRAN (R 4.2.0)
#>  P SummarizedExperiment * 1.28.0    2022-11-01 [?] Bioconductor
#>  P svglite                2.1.1     2023-01-10 [?] CRAN (R 4.2.0)
#>  P systemfonts            1.0.4     2022-02-11 [?] CRAN (R 4.2.0)
#>  P tibble               * 3.2.1     2023-03-20 [?] CRAN (R 4.2.0)
#>  P tidyr                * 1.3.0     2023-01-24 [?] CRAN (R 4.2.0)
#>  P tidyselect             1.2.0     2022-10-10 [?] CRAN (R 4.2.0)
#>  P tidyverse            * 2.0.0     2023-02-22 [?] CRAN (R 4.2.0)
#>  P timechange             0.2.0     2023-01-11 [?] CRAN (R 4.2.0)
#>  P tzdb                   0.4.0     2023-05-12 [?] CRAN (R 4.2.0)
#>  P UpSetR                 1.4.0     2019-05-22 [?] CRAN (R 4.2.0)
#>  P utf8                   1.2.3     2023-01-31 [?] CRAN (R 4.2.0)
#>  P vctrs                  0.6.2     2023-04-19 [?] CRAN (R 4.2.0)
#>  P vipor                  0.4.5     2017-03-22 [?] CRAN (R 4.2.0)
#>  P viridis                0.6.3     2023-05-03 [?] CRAN (R 4.2.0)
#>  P viridisLite            0.4.2     2023-05-02 [?] CRAN (R 4.2.0)
#>  P webshot                0.5.4     2022-09-26 [?] CRAN (R 4.2.0)
#>  P withr                  2.5.0     2022-03-03 [?] CRAN (R 4.2.0)
#>  P xfun                   0.39      2023-04-20 [?] CRAN (R 4.2.0)
#>  P xml2                   1.3.4     2023-04-27 [?] CRAN (R 4.2.0)
#>  P xtable                 1.8-4     2019-04-21 [?] CRAN (R 4.2.0)
#>  P XVector                0.38.0    2022-11-01 [?] Bioconductor
#>  P yaml                   2.3.7     2023-01-23 [?] CRAN (R 4.2.0)
#>  P zlibbioc               1.44.0    2022-11-01 [?] Bioconductor
#> 
#>  [1] /kyukon/data/gent/vo/000/gvo00063/Jeroen/DD_project_v2/benchmarks/covid/renv/library/R-4.2/x86_64-pc-linux-gnu
#>  [2] /kyukon/home/gent/460/vsc46052/.cache/R/renv/sandbox/R-4.2/x86_64-pc-linux-gnu/4df86545
#> 
#>  P ── Loaded and on-disk path mismatch.
#> 
#> ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────